<?php 
$userid = intval($TS_USER['user']['userid']);
if($userid == '0') header("Location: ".SITE_URL."index.php");

//我的秀店
$myGroup = $db->fetch_all_assoc("select * from ".dbprefix."group_users where userid='$userid'");

if($myGroup != ''){

	//我加入的秀店
	$myGroups = $db->fetch_all_assoc("select * from ".dbprefix."group_users where userid='$userid' limit 12");
	
	if(is_array($myGroups)){
		foreach($myGroups as $key=>$item){
			$arrMyGroup[] = $new['group']->getOneGroup($item['groupid']);
		}
	}
	
	$myCreateGroup = $db->fetch_all_assoc("select * from ".dbprefix."group where userid='$userid' limit 12");
	//我管理的秀店
	if(is_array($myCreateGroup)){
		foreach($myCreateGroup as $key=>$item){
			
				$arrMyAdminGroup[] = $new['group']->getOneGroup($item['groupid']);
			
		}
	}
	
	//我加入的所有秀店的话题
	
	if(is_array($myGroup)){
		foreach($myGroup as $item){
			$arrGroup[] = $item['groupid'];
		}
	}
	
	//@bug fixed by anythink
	$strGroup = implode(',',$arrGroup);
	if($strGroup){
		$arrTopics = $db->fetch_all_assoc("select topicid,userid,groupid,title,count_comment,count_view,istop,isphoto,isattach,addtime,uptime from ".dbprefix."group_topics where groupid in ($strGroup) and isshow='0' order by uptime desc limit 50");
		foreach($arrTopics as $key=>$item){
			$arrTopic[] = $item;
			$arrTopic[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
			$arrTopic[$key]['group'] = aac('group')->getSimpleGroup($item['groupid']);
		}
	}

}

$title = '我的首页';
include template("hot");